<div class="main_body">
    <?php echo $this->element('main_menu')?>	
	<div id="main_body_content">	
			
		<div class="ordersBillings view">
		<h1><?php  __("Orders Billing");?></h1>
			<dl><?php $i = 0; $class = ' class="altrow"';?>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Id"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $ordersBilling['OrdersBilling']['id']; ?>
					&nbsp;
				</dd>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Pay Number"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $ordersBilling['OrdersBilling']['pay_number']; ?>
					&nbsp;
				</dd>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Pay Date"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $ordersBilling['OrdersBilling']['pay_date']; ?>
					&nbsp;
				</dd>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Pay Nout"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $ordersBilling['OrdersBilling']['pay_nout']; ?>
					&nbsp;
				</dd>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Pay Value"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $ordersBilling['OrdersBilling']['pay_value']; ?>
					&nbsp;
				</dd>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Employee"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $this->Html->link($ordersBilling['Employee']['name'], array('controller' => 'employees', 'action' => 'view', $ordersBilling['Employee']['id'])); ?>
					&nbsp;
				</dd>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Date From"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $ordersBilling['OrdersBilling']['date_from']; ?>
					&nbsp;
				</dd>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Date To"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $ordersBilling['OrdersBilling']['date_to']; ?>
					&nbsp;
				</dd>
			</dl>
		</div>
		
		<div class="clr"></div>
		<div class="related index">
			<h1><?php __("Related Orders Series");?></h1>
			<?php if (!empty($ordersBilling['OrdersSeries'])):?>
			<table cellpadding = "0" cellspacing = "0">
			<tr>
				<th><?php __("Execution Date"); ?></th>
				<th><?php __("Payment Numer"); ?></th>
				<th><?php __("Salary"); ?></th>
				<th><?php __("Employee Salary"); ?></th>				
				<th class="actions"><?php __("Actions");?></th>
			</tr>
			<?php
				$i = 0;
				$salary = 0;
				$employee_salary = 0;
				foreach ($ordersBilling['OrdersSeries'] as $ordersSeries):
					$class = null;
					if ($i++ % 2 == 0) {
						$class = ' class="altrow"';
					}
					$salary = $salary + $ordersSeries['salary'];
					$employee_salary = $employee_salary + $ordersSeries['employee_salary'];
				?>
				<tr<?php echo $class;?>>
					<td><?php echo $ordersSeries['execution_date'];?></td>
					<td><?php echo $ordersSeries['payment_numer'];?></td>
					<td align="right"><?php echo $ordersSeries['salary'];?></td>
					<td align="right"><?php echo $ordersSeries['employee_salary'];?></td>					
					<td class="actions">
						<?php echo $this->Html->link($html->image(HOST.'/actions_16_view.png'), array('controller' => 'orders_series', 'action' => 'view', $ordersSeries['id']),array('title'=>__("View", true),'escape'=>false)); ?>
						<?php echo $this->Html->link($html->image(HOST.'/actions_16_edit.png'), array('controller' => 'orders_series', 'action' => 'edit', $ordersSeries['id']),array('title'=>__("Edit", true),'escape'=>false)); ?>
						<?php echo $this->Html->link($html->image(HOST.'/actions_16_delete.png'), array('controller' => 'orders_series', 'action' => 'delete', $ordersSeries['id']), array('title'=>__("Delete", true),'escape'=>false), sprintf(__("Are you sure you want to delete # %s?", true), $ordersSeries['id'])); ?>
						
					</td>
				</tr>
			<?php endforeach; ?>
				<tr>
					<th colspan="2"><?php __("Total salary")?></th>
					<th align="right"><?php echo $salary ?></th>
					<th align="right"><?php echo $employee_salary ?></th>					
					<th class="actions"><?php __("Actions");?></th>
				</tr>			
			</table>
		<?php endif; ?>
		</div>		
		
		<div class="clr"></div>	
	</div>		
	<?php echo $this->element('languages')?>	
	<div class="clr"></div>
	<br/>
</div>	
<div class="clr"></div>	
<div class="main_action">
	<div class="main_action_content">	
		
		<div class="actions">
			<h3><?php __("Actions"); ?></h3>
			<ul>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_billings_edit.png'), array('action' => 'edit',$ordersBilling['OrdersBilling']['id']),array('title'=>__("Edit Orders Billing", true),'escape'=>false)); ?><div class="clr"></div><?php echo __("Edit Orders Billing", true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_billings_delete.png'), array('action' => 'delete',$ordersBilling['OrdersBilling']['id']),array('title'=>__("Delete Orders Billing", true),'escape'=>false),sprintf(__("Are you sure you want to delete # %s?", true), $ordersBilling['OrdersBilling']['id'])); ?><div class="clr"></div><?php echo __("Delete Orders Billing", true)?></li>				
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_billings_index.png'), array('action' => 'index'),array('title'=>__("List Orders Billings", true),'escape'=>false)); ?><div class="clr"></div><?php echo __("List Orders Billings", true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_billings_add.png'), array('action' => 'add'),array('title'=>__("New Orders Billing", true),'escape'=>false)); ?><div class="clr"></div><?php echo __("New Orders Billing", true)?></li>
			</ul>
		</div>
		
		<div class="clr"></div>
	</div>		
</div>	
